//
//  HWDividedintoProportionCell.m
//  HWPromoteProjectAPP
//
//  Created by 陈道斌 on 2020/3/4.
//  Copyright © 2020 陈道斌. All rights reserved.
//

#import "HWDividedintoProportionCell.h"

@interface HWDividedintoProportionCell()

@property(strong,nonatomic)UIView *fenGeXianxiahuxian;
@property(strong,nonatomic)NSMutableArray *labelMuArr;
@property(strong,nonatomic)NSMutableArray *fengexianView;

@end

@implementation HWDividedintoProportionCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier    {
    
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        [self setupUI];
        
    }
    
    
    return self;
    
    
}


//设置UI
- (void)setupUI {
    
//       self.userLabel = [[UILabel alloc]initWithFrame:CGRectMake(8, 0, 62*CFLScaleValue, 46)];
//        self.userLabel .text = @"xiaosoos1";
//        self.userLabel .textAlignment =  NSTextAlignmentLeft;
//        self.userLabel .textColor = RGB(0, 0, 0);
//        self.userLabel .font = [UIFont systemFontOfSize:12];
//        self.userLabel.alpha = 0.65;
//        [self.contentView   addSubview: self.userLabel];
    
//    self.beijingView = [[UIView alloc]initWithFrame:CGRectMake(20, 0,self.contentView.width, self.contentView.height)];
//    self.beijingView.backgroundColor =  [UIColor whiteColor];
//    [self.contentView addSubview:self.beijingView];
//    
    
    
    CGFloat W = self.contentView.width;
    CGFloat H = self.contentView.height;
    self.labelMuArr = [[NSMutableArray alloc]init];
    self.fengexianView = [[NSMutableArray alloc]init];
    
    CGFloat meigelabeW = W / 6;
    
    
    
    for (int i = 0 ; i < 6; i++) {

          UILabel   *userLabel = [[UILabel alloc]initWithFrame:CGRectMake(meigelabeW*i, 0, meigelabeW, H)];
          userLabel.text = @"xia";
          userLabel.textAlignment =  NSTextAlignmentCenter;
          userLabel.textColor = RGB(0, 0, 0);
          userLabel.alpha = 0.65;
          userLabel .font = [UIFont systemFontOfSize:12];
           userLabel.hidden = YES;
          [self.contentView   addSubview: userLabel];
          [self.labelMuArr addObject:userLabel];
        
         
          


    }
    
    
    for (int i = 0 ; i < 6; i++) {

        UIView *fengexian = [[UIView alloc]initWithFrame:CGRectMake(i*meigelabeW, 0, 1, H)];
        fengexian.backgroundColor = RGB(232, 232, 232);
        [self.contentView addSubview:fengexian];
        fengexian.hidden = YES;
        [self.fengexianView addObject:fengexian];
        
    }
    
    
    
    UIView *xiahuxian = [[UIView alloc]initWithFrame:CGRectMake(0, H-1, W, 1)];
    xiahuxian.backgroundColor = RGB(232, 232, 232);
    self.fenGeXianxiahuxian = xiahuxian;
    [self.contentView addSubview:xiahuxian];
    
    
    
    
    
    
    
    
    
}


-(void)setDataArr:(NSArray *)dataArr {
    
      _dataArr = dataArr;
      NSInteger coun = dataArr.count;
      CGFloat W = kScreenW - 40;
      CGFloat H = 50;
    
    NSLog(@"宽度 %f ------ %f",W,H);
    
     CGFloat meigelabeW = W / (coun+1);
    
    
    for (int i = 0 ; i < coun; i++) {

        UILabel *label = self.labelMuArr[i];
        label.frame = CGRectMake(meigelabeW*i , 0, meigelabeW, H);
        label.text = [NSString stringWithFormat:@"%@",dataArr[i]];
        label.hidden = NO;
        
        if (i == 0) {
             label.frame = CGRectMake(meigelabeW*i , 0, meigelabeW*2, H);
        } else {
            
            label.frame = CGRectMake(meigelabeW*i + meigelabeW, 0, meigelabeW, H);
            
        }
    

    }
    
    
    self.fenGeXianxiahuxian.frame = CGRectMake(0, H-1, W, 1);
    
    
    for (int i = 0 ; i < 6; i++) {

//           UIView *fengexian = [[UIView alloc]initWithFrame:CGRectMake(i*meigelabeW, 0, 1, H)];
//           fengexian.backgroundColor = RGB(232, 232, 232);
//           [self.contentView addSubview:fengexian];
//           fengexian.hidden = YES;
//           [self.fengexianView addObject:fengexian];
           
          UIView *view = self.fengexianView[i];
         view.hidden = NO;
         if (i == 0) {
             view.frame = CGRectMake(i*meigelabeW, 0, 1, H);
             
         } else {
             
             
               view.frame = CGRectMake(i*meigelabeW+meigelabeW, 0, 1, H);
             
         }
        
        
        
       }
    
    
     
    
}


@end
